package com.dk.service.impl;


import com.dk.mapper.SkillMapper;
import com.dk.pojo.Achievement;
import com.dk.pojo.Skill;
import com.dk.service.AchService;
import com.dk.service.SkillService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class SkillServiceImpl implements SkillService {
    @Autowired
    private SkillMapper skillMapper;

    @Override
    public PageInfo<Skill> show(Integer pageNumber, Integer pageSize) {
        PageHelper.startPage(pageNumber,pageSize);
        List<Skill> list = skillMapper.selectByExample(null);
        PageInfo<Skill> page = new PageInfo<>(list);
        return page;
    }

    @Override
    public boolean addInfo(Skill skill) {
        return skillMapper.insert(skill) > 0;
    }

    @Override
    public Skill toUpdatet(Integer id) {
        return skillMapper.selectByPrimaryKey(id);
    }

    @Override
    public boolean updateInfo(Skill skill) {
        return skillMapper.updateByPrimaryKey(skill) > 0;
    }

    @Override
    public boolean deleteInfo(Integer id) {
        return skillMapper.deleteByPrimaryKey(id) > 0;
    }
}
